<template>
	<!-- 常用语详情 -->
	<view>
		<baseHead :title="title" :showReturn="true" text_right="保存" :right="true" @clickRight="clickRight"></baseHead>
		<view class="box">
			<u--textarea v-model="value1" placeholder="请输入内容" count maxlength="200"
				:disabled="dianji.Type==1?true:false"></u--textarea>
		</view>

	</view>
</template>

<script>
	import baseHead from "@/pages/component/baseHead.vue";

	export default {
		data() {
			return {
				title: "常用语详情",
				dianji: "",
				value1: "",
			};
		},
		components: {
			baseHead,

		},
		onLoad(option) {
			console.log(option.time);
			let opto = JSON.parse(option.time);

			this.dianji = opto;
			this.value1 = opto.Content;
		},
		created() {},
		methods: {
			clickRight() {

				if (this.dianji.Type == 1) {
					setTimeout(() => {
						uni.navigateBack();
					}, 1000)
					return;
				}



				if (!this.value1) {
					this.$util.toast("请输入");
					return;
				}
				let obj = {
					Id: this.dianji.Id,
					Content: this.value1,
				};
				this.$http.core.phrases_corpupdate(obj).then((res) => {
					console.log(res);
					if (res.Success) {
						this.$util.toast("修改成功");
						setTimeout(() => {
							uni.navigateBack();
						}, 1000);
					}
				})
			}

		}
	}
</script>

<style scoped lang="scss">
	.box {
		//   margin-top: 1rpx;
		padding: 30rpx 20rpx 0px;

		.content {
			background: #ffffff;
			padding: 30rpx 40rpx;
		}
	}
</style>